VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsCreateXMLDirCancel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public Function XMLCreateCancelDirective(ByRef strDllErrMsg As String) As String

    Dim xmldoc                  As MSXML2.DOMDocument
    Dim ProcessInst             As MSXML2.IXMLDOMProcessingInstruction
    
    Dim nKeytax                 As MSXML2.IXMLDOMNode
    Dim nResponse               As MSXML2.IXMLDOMNode
    
    Dim nlKeytax                As MSXML2.IXMLDOMNodeList
    Dim nlResponse              As MSXML2.IXMLDOMNodeList
    
    'Response
    Dim ellKeytax               As MSXML2.IXMLDOMElement
    Dim ellResponse             As MSXML2.IXMLDOMElement
    Dim ellSARSAppID            As MSXML2.IXMLDOMElement
    Dim ellDirectiveType        As MSXML2.IXMLDOMElement
    Dim ellCode                 As MSXML2.IXMLDOMElement
    Dim ellTextReason           As MSXML2.IXMLDOMElement
    
    On Error GoTo PROC_ERROR
    
    Set xmldoc = New MSXML2.DOMDocument
    
    'Must always specify, depending on what response file you are working with
    nTypeResponse = "04"
    
        'get header xml file
        Dim sGetXMLHeader           As Object
        Dim strXMLHeader            As String
        
        Set sGetXMLHeader = CreateObject("GenericXMLHeader.clsGetXMLHeader")
        strXMLHeader = sGetXMLHeader.GetXMLHeader(nReqSeqNum, nTypeResponse, nReferenceId, nComId, _
                                                  nBuId, nNewMessageID, sFormType, ServerName)
        xmldoc.loadXML (strXMLHeader)
      
    If xmldoc.xml <> "" Then
         XMLCreateCancelDirective = True
    Else
         XMLCreateCancelDirective = False
    End If
    
    XMLCreateCancelDirective = CStr(xmldoc.xml)
    
'clean up
Set sGetXMLHeader = Nothing
Set xmldoc = Nothing
Set ProcessInst = Nothing
Set nKeytax = Nothing
Set nResponse = Nothing
Set nlKeytax = Nothing
Set nlResponse = Nothing
Set ellKeytax = Nothing
Set ellResponse = Nothing
Set ellSARSAppID = Nothing
Set ellDirectiveType = Nothing
Set ellCode = Nothing
Set ellTextReason = Nothing

PROC_EXIT:
  Exit Function

PROC_ERROR:
    XMLCreateCancelDirective = False
'    Err.Raise Err.Number, _
'              "clsCreateDirCancel/XMLCreateCancelDirective", _
'              Err.Description
    strDllErrMsg = "clsCreateDirCancel/XMLCreateCancelDirective: " & Err.Number & " - " & Err.Description
            
Resume PROC_EXIT
  
End Function 'XMLCreateCancelDirective
Public Function CreateXmlVersionDtdHeader() As String
    Dim strXmlString As String

    strXmlString = "<?xml version=""1.0"" encoding=""UTF-8""?>" & Chr(13)
    'strXmlString = strXmlString & "<!DOCTYPE KeyTax SYSTEM ""C:\Shane\Projects\LCB\FormB\XML Docs\FormB_Response.dtd"">" & Chr(13)
    strXmlString = strXmlString & "<!DOCTYPE KeyTax SYSTEM """ & App.Path & "\CancelResponse.dtd"">" & Chr(13)

    CreateXmlVersionDtdHeader = strXmlString

End Function 'CreateXmlVersionDtdHeader






